<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:cc="http://java.sun.com/jsf/composite">

    <h:head>
	<title>This content will not be displayed</title>
    </h:head>

    <h:body>

	<cc:interface>
	    <cc:attribute name="tableId" required="true" />
	    <cc:attribute name="value" required="true" />
	    <cc:attribute name="listSize" required="true" />
	</cc:interface>

	<cc:implementation>

	    <div class="dataTable">
		<p:dataTable id="#{cc.attrs.tableId}" styleClass="dcListe"
			     value="#{cc.attrs.value}" var="imp" rows="#{cc.attrs.listSize}"
			     paginator="true" paginatorPosition="bottom">

		    <p:column sortBy="#{imp.imputation.date}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsDate}"/></f:facet>
			<h:outputText value="#{imp.imputation.date}">
			    <f:convertDateTime type="date" dateStyle="short" />
			</h:outputText>
		    </p:column>

		    <p:column sortBy="#{imp.imputation.task.code}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsTache}"/></f:facet>
			<h:commandLink value="#{imp.imputation.task.code}" action="IMP_CREATE">
			    <f:setPropertyActionListener target="#{sess.selectedTask}" value="#{imp.imputation.task}" />
			    <!-- TODO: tooltip does not seem to work in datatable -->
			    <p:tooltip>
				<h:outputText value="#{msg.impImputationsPopup}" styleClass="txtGras"/>
				<h:outputText value="#{imp.imputation.comment}"/>
			    </p:tooltip>
			</h:commandLink>
		    </p:column>

		    <p:column sortBy="#{imp.imputation.task.clientRequest.clientReference}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsDC}"/></f:facet>
			<h:outputText value="#{imp.imputation.task.clientRequest.clientReference}"/>
		    </p:column>

		    <p:column sortBy="#{imp.imputation.task.soldCharge}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsVendu}"/></f:facet>
			<h:outputText value="#{imp.imputation.task.soldCharge}"/>
		    </p:column>

		    <p:column sortBy="#{imp.consolidatedConsumate}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsConsolide}"/></f:facet>
			<h:outputText value="#{imp.consolidatedConsumate}"/>
		    </p:column>

		    <p:column sortBy="#{imp.etc}">
			<f:facet name="header"><h:outputText value="#{msg.impImputationsRAF}"/></f:facet>
			<h:outputText value="#{imp.imputation.etc}"/>
		    </p:column>
		    
		    <p:column>
			<f:facet name="header"><h:outputText value="#{msg.impImputationsDelete}"/></f:facet>
			<h:commandButton value="#{msg.impImputationsDeleteBut}" action="#{weeklyImputationsPage.deleteImputation(imp.imputation)}"
					 styleClass="button" onclick="return warnRemoveImput();">
			    <!-- TODO: confirmDialog is not supported in datatable right now
			    <p:confirmDialog message="#{msg.impImputationsDeleteConfirm}" />
			    -->
			</h:commandButton>
		    </p:column>

		</p:dataTable>
	    </div>

	</cc:implementation>

    </h:body>



</html>